<script language="javascript" type="text/javascript" src="/assets/My97DatePicker/jquery-1.8.2.js"></script>
<style>
    #ribbon{
        display:none;
    }
    body{
        background: none;
    }
</style>

<table  class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="1">
    <thead>
    <tr>
        <th style="text-align: center; vertical-align: middle;width:10%;" data-field="id"><div class="th-inner ">ID</div><div class="fht-cell"></div></th>
        <th style="text-align: center; vertical-align: middle;width:70%;" data-field="id"><div class="th-inner ">标题</div><div class="fht-cell"></div></th>
        <th style="text-align: center; vertical-align: middle;width:10%;" data-field="id"><div class="th-inner ">排序</div><div class="fht-cell"></div></th>
        </th>
    </tr>
    </thead>
    <tbody data-listidx="0">
    {volist name="list" id="vo"}
    <tr data-index="0" class="box12">
        <td style="text-align: center; vertical-align: middle; ">{$vo.id}</td>
        <td style="text-align: center; vertical-align: middle; ">{$vo.mark_info}</td>
        <td style="text-align: center; vertical-align: middle; ">
            <input type="number" min="0"  name="{$vo.id}"    no="mainorder"  value="{$vo.m_order}" style=" width:48px;height:36px;border:#ccc 1px solid;text-align: center;"/>
        </td>
    </tr>
    {/volist}
    <tr>
        <td colspan="3" style="padding-right:0px; ">
            <button onclick="sortSub();">排序</button>
        </td>
    </tr>

    </tbody>
</table>


<script>
    function sortSub(){
        var inputarr=  $("input[no='mainorder']");//根据属性值获取元素
        var arr=[];
        console.log(inputarr.length);
        for(var i=0;i<inputarr.length;i++){
            var obj1=$(inputarr[i]);
            var name=obj1.attr("name");
            var val=obj1.val();
            arr[i]=name+"-"+val;
        }
        $.ajax({
            type:"post",
            url:"/admin/mark/mark_sort_sub",
            data:{"arr":arr},
            dataType:"json",
            success:function(data){
                if(data.status==1){

                    parent.layer.closeAll();
                    window.parent.location.reload();//刷新父页面
                }else{
                    alert(data.message);
                }
            }
        });

    }
</script>